1. Technical Field
This invention generally relates to computer systems, and more specifically relates to apparatus and methods for sharing resources in a computer system.
2. Background Art
Since the dawn of the computer age, computer systems have evolved into extremely sophisticated devices, and computer systems may be found in many different settings. Research in the field of parallel processors has resulted in sophisticated computer systems that contain multiple processors capable of executing software tasks in parallel. In a multiprocessor system, there is typically one or more locks that allows the multiple processors to communicate with each other and to assure that certain limited system resources are available to each processor when required. Such locks typically reside in a memory that is globally accessible to all processors in the system, and indicate whether a resource on the computer system is available.
Each processor in a multiprocessor system typically includes its own instruction cache to speed the execution of code and data cache to speed accesses to memory. When a processor needs to access a resource that has access protected by a lock in globally-accessible memory, the processor must read the lock to determine whether the resource is available. In performing this read, the lock is typically read into the processor's cache. If the resource is available to the processor, the processor typically updates the lock to indicate that the processor has the resource. Because the lock is now residing in the processor's cache, this update is to the copy of the lock in the processor's cache. The cache manager detects that the lock in the processor's cache has been updated, and invalidates any other copies of the lock in other processors' caches. The cache manager then writes the updated lock from the processor's cache to main memory. The next time a different processor needs to access the lock, it must load the lock from memory into its cache, because its cached copy of the lock has been invalidated due to the change by a different processor.
For locks that are seldom accessed, the invalidation of cached copies of the lock in the caches of other processors provides little performance penalty. However, there are some locks that are accessed very frequently. One example of a frequently-accessed lock is during a seize of a database table. If the multiple processors often require shared access to a database table, the performance penalty of invalidating cached copies of the lock can become significant, and greatly increases memory bus traffic due to each processor having to retrieve the lock from memory almost each time it is needed due to its local copy being invalidated by another processor updating the lock in its own cache. Without a way to provide a synchronization mechanism that does not cause significant performance penalties when the shared resource is accessed often, the computer industry will continue to suffer from degraded performance when using known locks as synchronization mechanisms.